package com.mrd.modules.quartz;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

@Component
public class ScheduleJobInitListener implements ApplicationListener<ContextRefreshedEvent> {

  @Autowired
  private TaskInitBean taskInitBean;

  @Override
  public void onApplicationEvent(ContextRefreshedEvent event) {
    try {
      taskInitBean.init();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

}
